<form id="audit-form" class="form-horizontal" role="form" data-toggle="validator" method="POST" action="">
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('商家ID')}:</label>
        <div class="col-xs-12 col-sm-8">
            <p class="form-control-static">{$row.merchant_id}</p>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('店铺名称')}:</label>
        <div class="col-xs-12 col-sm-8">
            <p class="form-control-static">{$row.store_name}</p>
        </div>
    </div>
    <div class="form-group">
        <label class="control-label col-xs-12 col-sm-2">{:__('审核状态')}:</label>
        <div class="col-xs-12 col-sm-8">
            {:build_select('row[verification_status]', $statusList, null, ['class'=>'form-control selectpicker', 'data-rule'=>'required'])}
        </div>
    </div>
    <div class="form-group" id="reject-reason-group" style="display:none;">
        <label class="control-label col-xs-12 col-sm-2">{:__('拒绝原因')}:</label>
        <div class="col-xs-12 col-sm-8">
            <textarea id="reject_reason" class="form-control" name="row[reject_reason]" rows="5"></textarea>
        </div>
    </div>
    <div class="form-group layer-footer">
        <label class="control-label col-xs-12 col-sm-2"></label>
        <div class="col-xs-12 col-sm-8">
            <button type="submit" class="btn btn-success btn-embossed">{:__('确定')}</button>
            <button type="reset" class="btn btn-default btn-embossed">{:__('重置')}</button>
        </div>
    </div>
</form>
<script>
    $(function () {
        // 当审核状态改变时，显示或隐藏拒绝原因输入框
        $("select[name='row[verification_status]']").change(function () {
            if ($(this).val() == '3') {
                $("#reject-reason-group").show();
                $("#reject_reason").attr("data-rule", "required");
            } else {
                $("#reject-reason-group").hide();
                $("#reject_reason").removeAttr("data-rule");
            }
        });
        
        // 表单验证
        Form.api.bindevent($("#audit-form"), function(data, ret){
            //成功的回调
            Layer.closeAll();
            parent.Layer.alert(ret.msg, {icon: 1});
            parent.$("#table").bootstrapTable('refresh');
            return false;
        }, function(data, ret){
            //失败的回调
            Layer.alert(ret.msg, {icon: 2});
            return false;
        });
    });
</script>